#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

static uint64_t recurring_cycle_length(uint64_t denominator) {
    while (denominator && denominator % 2 == 0)
        denominator /= 2;

    while (denominator && denominator % 5 == 0)
        denominator /= 5;

    if (denominator == 0)
        return 0;

    if (denominator == 1)
        return 0;

    uint64_t r = 1;
    uint64_t n = 10 % denominator;  
    while (n != 1) {
        while (n < denominator) {
            n *= 10;
            ++r;
        }
        n = n % denominator;
    }
    return r;
}

int main() {
    vector<uint64_t> v (1000);
    for (int i = 0; i < v.size(); ++i)
        v[i] = recurring_cycle_length(i);
    cout << distance(v.begin(), max_element(v.begin(), v.end())) << endl;
    return 0;
}